Hang
Chu(hc772), Yingchuan Hu(yh537)
CS
4670/5670: Introduction to Computer Vision
September
16, 2013
Project 1: Image Scissors
We
implemented a Matlab GUI for Digital Matting, which allows users to choose
input images, select foreground/background regions by brush or loading
predesigned trimaps, and composite the final matting result with a background
image. We provide two methods for matting, based on these two papers:
A Bayesian
Approach to Digital Matting, CVPR 2001.
Learning
Based Digital Matting, ICCV 2009.
We
implemented the algorithms of the first paper, and included the source code of
the second paper (downloaded online from the author�s page) in the GUI as a
reference. Figure 1 and 2 show the selection of regions and the final merged
new image.
(This work
is finished in the division of: CVPR 2001 paper Bayesian Digital Matting by
Yingchuan Hu, GUI and integration of ICCV 2009 paper by Hang Chu.)
�
Figure 1. Brush selection
and matting result
Figure 2. A result of
matting
Digital Matting is definitely a strong tool. See the effects generated by our algorithm below in Figure 3.
(The Left is the input image, the middle is the rough partition and the right is the alpha map/mask generated by the algorithm. The edges for the hair are treated perfectly by implementing Bayesian estimation.)
Figure 3. The magic of
Bayesian matting
Brush Selection for Filter and Scissor
We implemented the brush selection tool in this project. Two shapes of brushes were provided: circle and square, and we modified the LiveWireDP() function, pixel _filter() function and image_filter() function so that the brush could function well. (Hold left Ctrl when doing the selection.)
(This work is finished by Yingchuan Hu.)
SeedSnap
We implemented the SeedSnap function, which takes the neighborhood of the clicked pixel and rearranged its position to the neighboring pixel that has the smallest link cost.
(This work is finished by Hang Chu.)
We started with the two following images: Gimli in the Lord of the Ring (Figure 4), and Noah (Figure 5).
Figure 4. Gimli
Figure 5. Noah
Initially, we used Scissor to do this work. After implementing the digital matting algorithm, we find it more efficient and accurate to use the matting function instead. In this case, we captured a part of the Gimli image, selected the foreground and background as is shown in Figure 5(Digital Matting algorithm requires a known partition of foreground, background and unknown pixels), and used matting to compute the alpha-map (optimal mask that fits perfectly for the edges, especially for fur and hair). The alpha map is shown in figure 7.
Figure 6. Selected regions
Figure 7. The
corresponding alpha map
We then changed the foreground image to Noah and merged it with Gimli using the alpha-map. (In order to align two faces accurately, we shift the Noah image right and down by certain amounts, which was done using matrix shifting in MATLAB.) Figure 8 shows the merged face.
Figure 8. Noah the Dwarf
Warrior!
After that, we put this merged face into the original Gimli image, added the result image of digital matting in Figure 2 to the bottom right, and some words & boxes by Photoshop, we have the final artifact in Figure 9.
Figure 9. The final artifact